# -*- coding: utf-8 -*-


class BarnMixin(object):
    __slots__ = ()

    def isfull(self):
        """是否已满。

        :rtype: bool
        """
        return self.amount >= self.capacity

    def upgrade(self):
        """提升等级。"""
        self.level += 1
        self.save()

    def asdict(self):
        return {
            'Level': self.level,
        }

    def ishighest(self):
        """是否已达等级上限。

        :rtype: bool
        """
        return self.level == self.max_level
